home *** CD-ROM | disk | FTP | other *** search
Wrap
<?xml version="1.0" encoding="utf-8"?> <html><head><title>End Statement [Runtime]</title><meta name="filename" content="text/sbasic/common/03090404"/><meta name="language" content="en-US"/><help:css-file-link xmlns:help="http://openoffice.org/2000/help"/><!--The CSS style header method for setting styles--><style type="text/css"> p.P1{ } p.P2{ } span.T1{ font-weight:bold;} </style></head><body> <help:to-be-embedded Eid="end" xmlns:help="http://openoffice.org/2000/help"> <p class="Head1"><help:link Id="66568">End Statement [Runtime]</help:link></p> <p class="Paragraph">Ends a procedure or block.</p> </help:to-be-embedded> <p class="Paragraph"><span class="T1">Syntax</span>:</p> <p class="Paragraph">End, End Function, End If, End Select, End Sub <help:key-word value="End" tag="kw66568_1" xmlns:help="http://openoffice.org/2000/help"/></p> <p class="Paragraph"><span class="T1">Parameter</span>:</p> <p class="Paragraph">Use the End statement as follows:</p> <p class="P2">Statement</p> <p class="Paragraph">End: Is not required, but can be entered anywhere within a procedure to end the program execution.</p> <p class="Paragraph">End Function: Ends a <span class="T1">Function</span> statement.</p> <p class="Paragraph">End If: Marks the end of a <span class="T1">If...Then...Else</span> block.</p> <p class="Paragraph">End Select: Marks the end of a <span class="T1">Select Case</span> block.</p> <p class="Paragraph">End Sub: Ends a <span class="T1">Sub</span> statement.</p> <p class="P2">Example:</p> <p class="PropText">Sub ExampleRandomSelect</p> <p class="PropText">Dim iVar As Integer</p> <p class="PropText">iVar = Int((15 * Rnd) -2)</p> <p class="PropText">Select Case iVar</p> <p class="PropText">Case 1 To 5</p> <p class="PropText">Print "Number from 1 to 5"</p> <p class="PropText">Case 6, 7, 8</p> <p class="PropText">Print "Number from 6 to 8"</p> <p class="PropText">Case Is > 8 And iVar < 11</p> <p class="PropText">Print "Greater than 8"</p> <p class="PropText">Case Else</p> <p class="PropText">Print "Outside range 1 to 10"</p> <p class="PropText">End Select</p> <p class="PropText">end sub</p> </body></html>